
<script lang="ts">
export default {
  name: "examineList"
}
</script>

<script setup lang="ts">
import { onMounted, reactive, ref, toRefs, getCurrentInstance } from 'vue';
import { TableInstance } from 'element-plus'
import {examineList} from '@/api/order/index'
import {Examine} from "@/api/order/types";
const dataTableRef = ref<TableInstance>()
const { proxy }: any = getCurrentInstance();
defineExpose({
  open
});
const state = reactive({
  dialog: {
    title: '审核详情',
    visible: false,
  } as DialogType,
  queryParams:{
  } as any,
  orderExamineList: [] as Examine[],
  total: 0,
  loading: true,
})

let {
  dialog,
  queryParams,
  orderExamineList,
  total,
  loading
} = toRefs(state);


function cancel() {
  dialog.value.visible = false;
}

async function handleQuery() {
  loading.value = true;
  let {data} = await examineList(queryParams.value.orderId);
  state.orderExamineList = data;
  console.log("sss",state.orderExamineList)
  state.loading = false;
}

function open(id:number) {
  console.log("row", id)
  dialog.value.visible = true;
  queryParams.value.orderId = id
  handleQuery()
}

</script>

<template>
  <el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" heigh=t destroy-on-close @close="cancel">
    <el-card>
      <el-table
        ref="dataTableRef"
        v-loading="loading"
        :data="orderExamineList"
        height="400"
        highlight-current-row
        border
      >
        <!--        <el-table-column type="selection" width="55" align="center" />-->
        <el-table-column label="节点名称" align="center" prop="nodeName" width="150" />
        <el-table-column label="审核人" align="center" prop="userName" min-width="150">
          <template #default="scope">
            <span>{{ scope.row.userName || "/" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="备注" align="center" prop="remark" width="150" />
        <el-table-column label="创建时间" align="center" prop="createTime" width="200" />
      </el-table>

      <!-- pagination -->
      <pagination
        v-if="total > 0"
        :total="total"
        v-model:page="queryParams.pageNum"
        v-model:limit="queryParams.pageSize"
        @pagination="handleQuery"
      />
    </el-card>
  </el-dialog>
</template>

<style scoped>

</style>

